/****************************************************************************
** Form implementation generated from reading ui file 'notatki_form.ui'
**
** Created: czw sty 26 22:10:57 2006
**      by: The User Interface Compiler ($Id: qt/main.cpp   3.3.4   edited Nov 24 2003 $)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/

#include "notatki_form.h"

#include <qvariant.h>
#include <qsqldatabase.h>
#include <qsqlcursor.h>
#include <qsqlform.h>
#include <qsqlrecord.h>
#include <qbuttongroup.h>
#include <qpushbutton.h>
#include <qdatatable.h>
#include <qdatabrowser.h>
#include <qlabel.h>
#include <qdatetimeedit.h>
#include <qlineedit.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h>

/*
 *  Constructs a Form3 as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 *  The dialog will by default be modeless, unless you set 'modal' to
 *  TRUE to construct a modal dialog.
 */
Form3::Form3( QWidget* parent, const char* name, bool modal, WFlags fl )
    : QDialog( parent, name, modal, fl )
{
    if ( !name )
	setName( "Form3" );

    buttonGroup16 = new QButtonGroup( this, "buttonGroup16" );
    buttonGroup16->setGeometry( QRect( 390, 10, 160, 190 ) );

    PushButtonInsert = new QPushButton( buttonGroup16, "PushButtonInsert" );
    PushButtonInsert->setGeometry( QRect( 20, 30, 114, 37 ) );

    PushButtonUpdate = new QPushButton( buttonGroup16, "PushButtonUpdate" );
    PushButtonUpdate->setGeometry( QRect( 20, 80, 115, 37 ) );

    PushButtonDelete = new QPushButton( buttonGroup16, "PushButtonDelete" );
    PushButtonDelete->setGeometry( QRect( 20, 130, 114, 37 ) );

    buttonGroup17 = new QButtonGroup( this, "buttonGroup17" );
    buttonGroup17->setGeometry( QRect( 10, 140, 371, 80 ) );

    PushButtonLast = new QPushButton( buttonGroup17, "PushButtonLast" );
    PushButtonLast->setGeometry( QRect( 286, 30, 80, 37 ) );

    PushButtonFirst = new QPushButton( buttonGroup17, "PushButtonFirst" );
    PushButtonFirst->setGeometry( QRect( 11, 30, 80, 37 ) );

    PushButtonNext = new QPushButton( buttonGroup17, "PushButtonNext" );
    PushButtonNext->setGeometry( QRect( 190, 30, 90, 37 ) );

    PushButtonPrev = new QPushButton( buttonGroup17, "PushButtonPrev" );
    PushButtonPrev->setGeometry( QRect( 97, 30, 87, 37 ) );

    dataTable5 = new QDataTable( this, "dataTable5" );
    dataTable5->addColumn( "data", tr( "Data" ) );
    dataTable5->addColumn( "godzina", tr( "Godzina" ) );
    dataTable5->addColumn( "tresc", tr( "Tresc" ) );
    dataTable5->setGeometry( QRect( 10, 230, 540, 161 ) );
    dataTable5->setReadOnly( TRUE );
    dataTable5->setSorting( TRUE );

    dataBrowser6 = new QDataBrowser( this, "dataBrowser6" );
    dataBrowser6->setGeometry( QRect( 10, 10, 370, 120 ) );

    labelGodzina = new QLabel( dataBrowser6, "labelGodzina" );
    labelGodzina->setGeometry( QRect( 12, 80, 68, 28 ) );

    labelTresc = new QLabel( dataBrowser6, "labelTresc" );
    labelTresc->setGeometry( QRect( 12, 12, 68, 28 ) );

    labelData = new QLabel( dataBrowser6, "labelData" );
    labelData->setGeometry( QRect( 12, 46, 68, 28 ) );

    QDateEditData = new QDateEdit( dataBrowser6, "QDateEditData" );
    QDateEditData->setGeometry( QRect( 86, 46, 281, 28 ) );

    QLineEditTresc = new QLineEdit( dataBrowser6, "QLineEditTresc" );
    QLineEditTresc->setGeometry( QRect( 86, 12, 281, 28 ) );

    QTimeEditGodzina = new QTimeEdit( dataBrowser6, "QTimeEditGodzina" );
    QTimeEditGodzina->setGeometry( QRect( 86, 80, 281, 30 ) );

    QSqlForm* dataBrowser6Form =  new QSqlForm( this, "dataBrowser6Form" );
    dataBrowser6Form->insert( QDateEditData, "data" );
    dataBrowser6Form->insert( QLineEditTresc, "tresc" );
    dataBrowser6Form->insert( QTimeEditGodzina, "godzina" );
    dataBrowser6->setForm( dataBrowser6Form );
    languageChange();
    resize( QSize(556, 399).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( PushButtonFirst, SIGNAL( clicked() ), dataBrowser6, SLOT( first() ) );
    connect( dataBrowser6, SIGNAL( firstRecordAvailable( bool ) ), PushButtonFirst, SLOT( setEnabled(bool) ) );
    connect( PushButtonPrev, SIGNAL( clicked() ), dataBrowser6, SLOT( prev() ) );
    connect( dataBrowser6, SIGNAL( prevRecordAvailable( bool ) ), PushButtonPrev, SLOT( setEnabled(bool) ) );
    connect( PushButtonNext, SIGNAL( clicked() ), dataBrowser6, SLOT( next() ) );
    connect( dataBrowser6, SIGNAL( nextRecordAvailable( bool ) ), PushButtonNext, SLOT( setEnabled(bool) ) );
    connect( PushButtonLast, SIGNAL( clicked() ), dataBrowser6, SLOT( last() ) );
    connect( dataBrowser6, SIGNAL( lastRecordAvailable( bool ) ), PushButtonLast, SLOT( setEnabled(bool) ) );
    connect( PushButtonInsert, SIGNAL( clicked() ), dataBrowser6, SLOT( insert() ) );
    connect( PushButtonUpdate, SIGNAL( clicked() ), dataBrowser6, SLOT( update() ) );
    connect( PushButtonDelete, SIGNAL( clicked() ), dataBrowser6, SLOT( del() ) );
}

/*
 *  Destroys the object and frees any allocated resources
 */
Form3::~Form3()
{
    // no need to delete child widgets, Qt does it all for us
}

/*
 *  Widget polish.  Reimplemented to handle
 *  default data table initialization
 *  default data browser initialization
 */
void Form3::polish()
{
    if ( dataTable5 ) {
        QSqlCursor* cursor = dataTable5->sqlCursor();
        if ( !cursor ) {
            cursor = new QSqlCursor( "notatki" );
            if ( dataTable5->isReadOnly() ) 
                cursor->setMode( QSqlCursor::ReadOnly );
            dataTable5->setSqlCursor( cursor, FALSE, TRUE );
        }
        if ( !cursor->isActive() )
            dataTable5->refresh( QDataTable::RefreshAll );
    }
    if ( dataBrowser6 ) {
        if ( !dataBrowser6->sqlCursor() ) {
            QSqlCursor* cursor = new QSqlCursor( "notatki" );
            dataBrowser6->setSqlCursor( cursor, TRUE );
            dataBrowser6->refresh();
            dataBrowser6->first();
        }
    }
    QDialog::polish();
}

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void Form3::languageChange()
{
    setCaption( tr( "Notatki" ) );
    buttonGroup16->setTitle( tr( "Edycja" ) );
    PushButtonInsert->setText( tr( "&Insert" ) );
    PushButtonInsert->setAccel( QKeySequence( tr( "Alt+I" ) ) );
    PushButtonUpdate->setText( tr( "&Update" ) );
    PushButtonUpdate->setAccel( QKeySequence( tr( "Alt+U" ) ) );
    PushButtonDelete->setText( tr( "&Delete" ) );
    PushButtonDelete->setAccel( QKeySequence( tr( "Alt+D" ) ) );
    buttonGroup17->setTitle( tr( "Nawigacja" ) );
    PushButtonLast->setText( tr( "&Last >|" ) );
    PushButtonLast->setAccel( QKeySequence( tr( "Alt+L" ) ) );
    PushButtonFirst->setText( tr( "|< &First" ) );
    PushButtonFirst->setAccel( QKeySequence( tr( "Alt+F" ) ) );
    PushButtonNext->setText( tr( "&Next >>" ) );
    PushButtonNext->setAccel( QKeySequence( tr( "Alt+N" ) ) );
    PushButtonPrev->setText( tr( "<< &Prev" ) );
    PushButtonPrev->setAccel( QKeySequence( tr( "Alt+P" ) ) );
    labelGodzina->setText( tr( "Godzina" ) );
    labelTresc->setText( tr( "Tresc" ) );
    labelData->setText( tr( "Data" ) );
}

